from django.contrib import admin
from .models import Calendar, Event, EventChat

@admin.register(Calendar)
class CalendarAdmin(admin.ModelAdmin):
    list_display = ('date', 'year', 'month')
    list_filter = ('year', 'month')
    search_fields = ('date',)

@admin.register(Event)
class EventAdmin(admin.ModelAdmin):
    list_display = [
        'id', 
        'title', 
        'date', 
        'start_time', 
        'end_time', 
        'period', 
        'status',
        'user',
        'creator_id',
        'importance',
        'location'
    ]
    list_filter = [
        'status',
        'period',
        'importance',
        'user',
        'date'
    ]
    search_fields = [
        'title',
        'description',
        'location',
        'user__username',
        'creator_id'
    ]
    date_hierarchy = 'date'
    readonly_fields = ['created_at', 'updated_at', 'creator_id']

@admin.register(EventChat)
class EventChatAdmin(admin.ModelAdmin):
    list_display = ['id', 'event', 'created_at']
    list_filter = ['created_at']
    search_fields = ['event__title', 'user_message', 'ai_response']
    date_hierarchy = 'created_at'

